package com.weibopay.gf.testing;

import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.asymmetric.RSA;

import java.security.KeyPair;

/**
 * 生成RSA公私钥
 */
public class RSAKeyGenerate {
    public static void main(String[] args) {
        KeyPair keyPair = SecureUtil.generateKeyPair("RSA");
        RSA rsa = SecureUtil.rsa(keyPair.getPrivate().getEncoded(), keyPair.getPublic().getEncoded());
        System.out.println("===========================================");
        System.out.println("RSA私钥：" + rsa.getPrivateKeyBase64());
        System.out.println("===========================================");
        System.out.println("RSA公钥: " + rsa.getPublicKeyBase64());
        System.out.println("===========================================");

    }
}
